package main;

import User.Administrators;
import User.OrdinaryUsers;
import User.Person;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 邓大帅
 * Date: 2022-12-20
 * Time: 10:21
 */
public class Main {
    public static Person login() {
        System.out.println("请输入姓名");
        Scanner input = new Scanner(System.in);
        String name = input.nextLine();
        System.out.println("请输入你的身份：1-》管理员  0-》普通用户");
        int choice = input.nextInt();
        if(choice == 1){
            return new Administrators(name);
        }
        else{
            return new OrdinaryUsers(name);
        }
    }
    public static void main(String[] args) {
        Person user = login();
        BookList bookList = new BookList();
        while (true) {
            int choice = user.menu();
            user.doWork(choice,bookList);
        }
    }
}
